package com.example.twoservice.controller;


import com.example.twoservice.common.ResponseDto;
import com.example.twoservice.domain.Product;
import com.example.twoservice.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LXG
 * @since 2021-06-07
 */
@Controller
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    /**
     * 新增
     * @param product
     */
    @PostMapping("/addProduct")
    @ResponseBody
    public ResponseDto addUser(@RequestBody Product product) {
        productService.addProduct(product);
        return new ResponseDto(0,"添加成功");
    }


}

